News All Tests
Current file: /home/estudydev/workspace/MSP09/web/news/tests/class.newscategorystyles.inc.php
Legend: executed not executed dead code

  Coverage
  Classes Methods Lines
Total
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 7
5.88 %5.88%
5.88% 3 / 51
 
NewsCategoryStyles
100.00 %100.00%
100.00% 1 / 1
0.00 %0.00%
0.00% 0 / 7
2.04 %2.04%
2.04% 1 / 49
 public function __construct($catID, $courses, $categorySettings = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 3
 public function echoNews($courseID, $usergroup = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 6
 public function isInstalled($courseID)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function canSelectPeriod()
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 1
 public function getNewsHeaderTitle($courseID = NULL, $type = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 4
 protected function getNewsByPeriod($courseID, $from, $to, $lastvisit, $usergroup = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 20
 protected function echoNewsEntry($entry, $courseID, $usergroup = NULL)
0.00 %0.00%
0.00% 0 / 1
0.00 %0.00%
0.00% 0 / 13


       1                 : <?php                                                                                                                                    
       2                 : /*--------------------------------------------------------------------------+                                                            
       3                 : This file is part of eStudy.                                                                                                             
       4                 : news/classes/class.NewsCategoryStyles.inc.php                                                                                            
       5                 : - Modulgruppe:  News                                                                                                                     
       6                 : - Beschreibung: Klasse für die News-Kategorie eStudy-Styles.                                                                            
       7                 : - Version:      1.1.2.4, 24/01/08                                                                                                        
       8                 : - Autor(en):    Corinna Kropf <corinna.kropf@mni.fh-giessen.de>                                                                          
       9                 : +---------------------------------------------------------------------------+                                                            
      10                 : This program is free software; you can redistribute it and/or                                                                            
      11                 : modify it under the terms of the GNU General Public License                                                                              
      12                 : as published by the Free Software Foundation; either version 2                                                                           
      13                 : of the License, or any later version.                                                                                                    
      14                 : +---------------------------------------------------------------------------+                                                            
      15                 : This program is distributed in the hope that it will be useful,                                                                          
      16                 : but WITHOUT ANY WARRANTY; without even the implied warranty of                                                                           
      17                 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                                            
      18                 : GNU General Public License for more details.                                                                                             
      19                 : You should have received a copy of the GNU General Public License                                                                        
      20                 : along with this program; if not, write to the Free Software                                                                              
      21                 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                                                              
      22                 : +--------------------------------------------------------------------------*/                                                            
      23                 :                                                                                                                                          
      24               1 : require_once ("class.newscategory.inc.php");                                                                                             
      25               1 : require_once ("class.style.inc.php");                                                                                                    
      26                 :                                                                                                                                          
      27                 : /**                                                                                                                                      
      28                 :  * Klasse für die News-Kategorie Styles.                                                                                                
      29                 :  * @package eStudy.News                                                                                                                  
      30                 :  * @version 1.1.2.4, 24/01/08                                                                                                            
      31                 :  * @author  Corinna Kropf <corinna.kropf@mni.fh-giessen.de>                                                                              
      32                 :  */                                                                                                                                      
      33               1 : class NewsCategoryStyles extends NewsCategory                                                                                            
      34                 : {                                                                                                                                        
      35                 :    /**                                                                                                                                   
      36                 :      * Flag fuer die Anzeige der News-Eintraege                                                                                          
      37                 :      * @var bool                                                                                                                         
      38                 :      */                                                                                                                                  
      39                 :     private $dark;                                                                                                                       
      40                 :    /**                                                                                                                                   
      41                 :      * HTML-Template                                                                                                                     
      42                 :      * @var Template                                                                                                                     
      43                 :      */                                                                                                                                  
      44                 :     private $newsTemplate;                                                                                                               
      45                 :     /**                                                                                                                                  
      46                 :      * Konstruktor                                                                                                                       
      47                 :      */                                                                                                                                  
      48                 :     public function __construct($catID, $courses, $categorySettings = null)                                                              
      49                 :     {                                                                                                                                    
      50               0 :         parent::__construct($catID, $courses, $categorySettings);                                                                        
      51               0 :         $this->newsTemplate = new Template(PATH_TO_ROOT."news/templates/newsstyle.html");                                                
      52               0 :     }                                                                                                                                    
      53                 :    /**                                                                                                                                   
      54                 :      * Überschreibt die Methode der Oberklasse,                                                                                         
      55                 :      * um weitere Initialisierungen vor der Ausgabe zu machen.                                                                           
      56                 :      * @see NewsCategory                                                                                                                 
      57                 :      */                                                                                                                                  
      58                 :     public function echoNews($courseID, $usergroup = null)                                                                               
      59                 :     {                                                                                                                                    
      60               0 :         if($courseID == 0)                                                                                                               
      61               0 :         {                                                                                                                                
      62               0 :             $this->dark = false;                                                                                                         
      63               0 :             parent::echoNews($courseID, $usergroup);                                                                                     
      64               0 :         }                                                                                                                                
      65               0 :     }                                                                                                                                    
      66                 :     /**                                                                                                                                  
      67                 :      * @see NewsCategory                                                                                                                 
      68                 :      */                                                                                                                                  
      69                 :     public function isInstalled($courseID)                                                                                               
      70                 :     {                                                                                                                                    
      71               0 :         return (($courseID == 0)? true : false);                                                                                         
      72                 :     }                                                                                                                                    
      73                 :     /**                                                                                                                                  
      74                 :      * @see NewsCategory                                                                                                                 
      75                 :      */                                                                                                                                  
      76                 :     public function canSelectPeriod() {                                                                                                  
      77               0 :         return false;                                                                                                                    
      78                 :     }                                                                                                                                    
      79                 :     /**                                                                                                                                  
      80                 :      * @see NewsCategory                                                                                                                 
      81                 :      */                                                                                                                                  
      82                 :     public function getNewsHeaderTitle($courseID = null, $type = null) {                                                                 
      83               0 :         $newsCount = $this->news["count"];                                                                                               
      84               0 :         if ($newsCount > 1) $title = sprintf( $this->translate->_("%1\$s eStudy-Styles"), $newsCount);                                   
      85               0 :         else $title = $this->translate->_("1 eStudy-Style");                                                                             
      86                 :                                                                                                                                          
      87               0 :         return $title;                                                                                                                   
      88                 :     }                                                                                                                                    
      89                 :                                                                                                                                          
      90                 :     /**                                                                                                                                  
      91                 :      * @see NewsCategory                                                                                                                 
      92                 :      */                                                                                                                                  
      93                 :     protected function getNewsByPeriod($courseID, $from, $to, $lastvisit, $usergroup = null)  {                                          
      94               0 :         if (isset($courseID) && isset($lastvisit))                                                                                       
      95               0 :         {                                                                                                                                
      96               0 :             if(!is_numeric($courseID) || !is_numeric($lastvisit)) return null;                                                           
      97                 :                                                                                                                                          
      98               0 :             $this->news = array();                                                                                                       
      99                 :                                                                                                                                          
     100               0 :                $styles = Style::getStyleTemplates();                                                                                     
     101               0 :                if (!empty($styles))                                                                                                      
     102               0 :                {                                                                                                                         
     103               0 :                    $count = 0;                                                                                                           
     104               0 :                    foreach($styles as $style) {                                                                                          
     105               0 :                        $date = explode(".", $style[3]);                                                                                  
     106               0 :                        if (count($date) == 3 && mktime(23, 59, 59, intval($date[1]), intval($date[0]), intval($date[2])) >= $lastvisit) {
     107               0 :                            $this->news["data"][] = $style;                                                                               
     108               0 :                            $count++;                                                                                                     
     109               0 :                        }                                                                                                                 
     110               0 :                    }                                                                                                                     
     111               0 :                    if ($count > 0) $this->news["count"] = $count;                                                                        
     112               0 :                    else $this->news = null;                                                                                              
     113               0 :                }                                                                                                                         
     114               0 :         }                                                                                                                                
     115                 :                                                                                                                                          
     116               0 :         return $this->news;                                                                                                              
     117                 :     }                                                                                                                                    
     118                 :     /**                                                                                                                                  
     119                 :      * @see NewsCategory                                                                                                                 
     120                 :      */                                                                                                                                  
     121                 :     protected function echoNewsEntry($entry, $courseID, $usergroup = null)                                                               
     122                 :     {                                                                                                                                    
     123               0 :         if(!isset($this->dark) || !isset($entry)) return;                                                                                
     124                 :                                                                                                                                          
     125               0 :            if ($courseID == 0)                                                                                                           
     126               0 :            {                                                                                                                             
     127               0 :             $styleInfo1 = Data::toHTML($entry[1], false);                                                                                
     128               0 :             $styleInfo4 = Data::toHTML($entry[4], false);                                                                                
     129               0 :             $scriptPath = PATH_TO_ROOT."style/index.php";                                                                                
     130               0 :             $styleInfo0 = Data::toHTML($entry[0], false);                                                                                
     131               0 :             $cellStyle = ($this->dark ? "Dark" : "");                                                                                    
     132                 :                                                                                                                                          
     133               0 :             $g_Styleuebernehmen = $this->translate->_("Style &uuml;bernehmen");                                                          
     134                 :                                                                                                                                          
     135               0 :             eval($this->newsTemplate->GetTemplate());                                                                                    
     136               0 :             $this->dark = !$this->dark;                                                                                                  
     137               0 :            }                                                                                                                             
     138               0 :     }                                                                                                                                    
     139                 : }                                                                                                                                        

Generated by PHPUnit 3.2.21 and Xdebug 2.0.4 at Sat Nov 7 22:04:08 CET 2009.